3.115 \(\int \frac{\sin ^2(a+\frac{b}{x})}{x^2} \, dx\)

Optimal. Leaf size=31 \[ \frac{\sin \left (a+\frac{b}{x}\right ) \cos \left (a+\frac{b}{x}\right )}{2 b}-\frac{1}{2 x} \]

[Out]

-1/(2*x) + (Cos[a + b/x]*Sin[a + b/x])/(2*b)

________________________________________________________________________________________

Rubi [A]  time = 0.0268488, antiderivative size = 31, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 14, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.214, Rules used = {3379, 2635, 8} \[ \frac{\sin \left (a+\frac{b}{x}\right ) \cos \left (a+\frac{b}{x}\right )}{2 b}-\frac{1}{2 x} \]

Antiderivative was successfully verified.

[In]

Int[Sin[a + b/x]^2/x^2,x]

[Out]

-1/(2*x) + (Cos[a + b/x]*Sin[a + b/x])/(2*b)

Rule 3379

Int[(x_)^(m_.)*((a_.) + (b_.)*Sin[(c_.) + (d_.)*(x_)^(n_)])^(p_.), x_Symbol] :> Dist[1/n, Subst[Int[x^(Simplif
y[(m + 1)/n] - 1)*(a + b*Sin[c + d*x])^p, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p}, x] && IntegerQ[Simpl
ify[(m + 1)/n]] && (EqQ[p, 1] || EqQ[m, n - 1] || (IntegerQ[p] && GtQ[Simplify[(m + 1)/n], 0]))

Rule 2635

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> -Simp[(b*Cos[c + d*x]*(b*Sin[c + d*x])^(n - 1))/(d*n),
x] + Dist[(b^2*(n - 1))/n, Int[(b*Sin[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && Integer
Q[2*n]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rubi steps

\begin{align*} \int \frac{\sin ^2\left (a+\frac{b}{x}\right )}{x^2} \, dx &=-\operatorname{Subst}\left (\int \sin ^2(a+b x) \, dx,x,\frac{1}{x}\right )\\ &=\frac{\cos \left (a+\frac{b}{x}\right ) \sin \left (a+\frac{b}{x}\right )}{2 b}-\frac{1}{2} \operatorname{Subst}\left (\int 1 \, dx,x,\frac{1}{x}\right )\\ &=-\frac{1}{2 x}+\frac{\cos \left (a+\frac{b}{x}\right ) \sin \left (a+\frac{b}{x}\right )}{2 b}\\ \end{align*}

Mathematica [A]  time = 0.0555031, size = 32, normalized size = 1.03 \[ \frac{\sin \left (2 \left (a+\frac{b}{x}\right )\right )}{4 b}-\frac{a+\frac{b}{x}}{2 b} \]

Antiderivative was successfully verified.

[In]

Integrate[Sin[a + b/x]^2/x^2,x]

[Out]

-(a + b/x)/(2*b) + Sin[2*(a + b/x)]/(4*b)

________________________________________________________________________________________

Maple [A]  time = 0.007, size = 34, normalized size = 1.1 \begin{align*} -{\frac{1}{b} \left ( -{\frac{1}{2}\cos \left ( a+{\frac{b}{x}} \right ) \sin \left ( a+{\frac{b}{x}} \right ) }+{\frac{a}{2}}+{\frac{b}{2\,x}} \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(a+b/x)^2/x^2,x)

[Out]

-1/b*(-1/2*cos(a+b/x)*sin(a+b/x)+1/2*a+1/2*b/x)

________________________________________________________________________________________

Maxima [A]  time = 0.962725, size = 34, normalized size = 1.1 \begin{align*} \frac{x \sin \left (\frac{2 \,{\left (a x + b\right )}}{x}\right ) - 2 \, b}{4 \, b x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(a+b/x)^2/x^2,x, algorithm="maxima")

[Out]

1/4*(x*sin(2*(a*x + b)/x) - 2*b)/(b*x)

________________________________________________________________________________________

Fricas [A]  time = 1.21303, size = 72, normalized size = 2.32 \begin{align*} \frac{x \cos \left (\frac{a x + b}{x}\right ) \sin \left (\frac{a x + b}{x}\right ) - b}{2 \, b x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(a+b/x)^2/x^2,x, algorithm="fricas")

[Out]

1/2*(x*cos((a*x + b)/x)*sin((a*x + b)/x) - b)/(b*x)

________________________________________________________________________________________

Sympy [A]  time = 4.39074, size = 262, normalized size = 8.45 \begin{align*} \begin{cases} - \frac{b \tan ^{4}{\left (\frac{a}{2} + \frac{b}{2 x} \right )}}{2 b x \tan ^{4}{\left (\frac{a}{2} + \frac{b}{2 x} \right )} + 4 b x \tan ^{2}{\left (\frac{a}{2} + \frac{b}{2 x} \right )} + 2 b x} - \frac{2 b \tan ^{2}{\left (\frac{a}{2} + \frac{b}{2 x} \right )}}{2 b x \tan ^{4}{\left (\frac{a}{2} + \frac{b}{2 x} \right )} + 4 b x \tan ^{2}{\left (\frac{a}{2} + \frac{b}{2 x} \right )} + 2 b x} - \frac{b}{2 b x \tan ^{4}{\left (\frac{a}{2} + \frac{b}{2 x} \right )} + 4 b x \tan ^{2}{\left (\frac{a}{2} + \frac{b}{2 x} \right )} + 2 b x} - \frac{2 x \tan ^{3}{\left (\frac{a}{2} + \frac{b}{2 x} \right )}}{2 b x \tan ^{4}{\left (\frac{a}{2} + \frac{b}{2 x} \right )} + 4 b x \tan ^{2}{\left (\frac{a}{2} + \frac{b}{2 x} \right )} + 2 b x} + \frac{2 x \tan{\left (\frac{a}{2} + \frac{b}{2 x} \right )}}{2 b x \tan ^{4}{\left (\frac{a}{2} + \frac{b}{2 x} \right )} + 4 b x \tan ^{2}{\left (\frac{a}{2} + \frac{b}{2 x} \right )} + 2 b x} & \text{for}\: b \neq 0 \\- \frac{\sin ^{2}{\left (a \right )}}{x} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(a+b/x)**2/x**2,x)

[Out]

Piecewise((-b*tan(a/2 + b/(2*x))**4/(2*b*x*tan(a/2 + b/(2*x))**4 + 4*b*x*tan(a/2 + b/(2*x))**2 + 2*b*x) - 2*b*
tan(a/2 + b/(2*x))**2/(2*b*x*tan(a/2 + b/(2*x))**4 + 4*b*x*tan(a/2 + b/(2*x))**2 + 2*b*x) - b/(2*b*x*tan(a/2 +
 b/(2*x))**4 + 4*b*x*tan(a/2 + b/(2*x))**2 + 2*b*x) - 2*x*tan(a/2 + b/(2*x))**3/(2*b*x*tan(a/2 + b/(2*x))**4 +
 4*b*x*tan(a/2 + b/(2*x))**2 + 2*b*x) + 2*x*tan(a/2 + b/(2*x))/(2*b*x*tan(a/2 + b/(2*x))**4 + 4*b*x*tan(a/2 +
b/(2*x))**2 + 2*b*x), Ne(b, 0)), (-sin(a)**2/x, True))

________________________________________________________________________________________

Giac [A]  time = 1.09892, size = 30, normalized size = 0.97 \begin{align*} \frac{\sin \left (2 \, a + \frac{2 \, b}{x}\right )}{4 \, b} - \frac{1}{2 \, x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(a+b/x)^2/x^2,x, algorithm="giac")

[Out]

1/4*sin(2*a + 2*b/x)/b - 1/2/x